﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UI
{
    public partial class Repairs : Form
    {
        public Repairs()
        {
            InitializeComponent();
        }
        
        string currSearchContent = "";
        BLL.Serve bLKM = new BLL.Serve ();
        Model.Serve mLKM = new Model.Serve();
        private void Repairs_Load(object sender, EventArgs e)
        {

        }
        public void bindGrudView()
        {
            dgvReMassage.DataSource = bLKM.select(currSearchContent);
        }
        private void button1_Click(object sender, EventArgs e)
        {
            mLKM.UserID  = textBox1.Text;
            mLKM.Name  = textBox2.Text;
            mLKM.Number = textBox3.Text;
            mLKM.Iteams  = listBox1 .SelectedItem.ToString();
            mLKM.StaName = "未接单";
            string a = "UserID";
            bool result = false  ;       
            result = bLKM.insert1(mLKM);                      
            if (result)
            {
                currSearchContent = a+ " like '%" + textBox1.Text + "%'";
                bindGrudView();
                MessageBox.Show("报修成功！");
                textBox1.Text = "";
                textBox2.Text = "";
                textBox3.Text = "";
            }
            else
                MessageBox.Show( "报修失败！");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            
            currSearchContent =  "UserID" + " like '%" + textBox4.Text + "%'";
            bindGrudView();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
